﻿using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Collections;


namespace INJECTOR
{
    public class FixedInjectorGroup
    {
        public Injector[] AllInjectors = new Injector[] { };
        public string[] Testplans = new string[] { };
        public FixedInjectorGroup(int count, ArrayList InjectorArrayList)//构造函数
        {
            int i = 0;
            ArrayList TPs = new ArrayList();
            AllInjectors = new Injector[count];

            //TPs.Add(AllInjectors[0].getTestplan());//第一个Testplan
            foreach (Injector stemp in InjectorArrayList)
            {
                AllInjectors[i++] = stemp;
            }
            TPs.Add(AllInjectors[0].Testplan);//第一个Testplan
            foreach (Injector stemp in InjectorArrayList)
            {
                if (!TPs.Contains(stemp.Testplan)) TPs.Add(stemp.Testplan);
            }

            i = 0;
            Testplans = new string[TPs.Count];//此处如果在句首加上 new的话，这个Testplans就成了这个子程序的私有变量了，所以不能加new !!
            foreach (string stemp in TPs)
            {
                Testplans[i] = TPs[i++].ToString();

            }
        }
        public Injector[] GetInjectorsFromTestplan(string testplan)
        {
            Injector[] temp = new Injector[] { };
            int i = 0;
            foreach (Injector stemp in AllInjectors)
            {
                if (stemp.Testplan == testplan) temp[i++] = stemp;
            }
            return temp;

        }
    }

    public struct Injector
    {
        public string Testplan;
        public double Qs;
        public double Qd;
        public double QsShift;
        public double QdShift;
        public double Qs_BAL;
        public double Qd_BAL;
        public double Qs_BAL_Shift;
        public double Qd_BAL_Shift;
        public double Qs_FM;
        public double Qd_FM;
        public double Qs_FM_Shift;
        public double Qd_FM_Shift;
        public double TestPressure;
        public string Matrix;
    }
}
